#include <functional>
#include "Log.hpp"
#include "ThreadPool.hpp"

using namespace LogModule;
using namespace ThreadPoolModule;

void Download()
{
    std::cout << "下载一个任务" << std::endl;
    sleep(3); // 假设任务的耗时。
}

using task_t = std::function<void()>;

int main()
{
    Enable_Console_Log_Strategy();

    int count = 10;
    while (count)
    {
        sleep(1);
        ThreadPool<task_t>::GetInstance()->Enqueue(Download);
        count--;
    }

    ThreadPool<task_t>::GetInstance()->Stop();
    ThreadPool<task_t>::GetInstance()->Join();    

    return 0;
}